package com.neouton.crm.pm.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neouton.common.util.PageUtil;
import com.neouton.common.util.ResponseAPI;
import com.neouton.crm.customer.entity.CustomerVO;
import com.neouton.crm.payRecords.entity.PaymentRequest;
import com.neouton.crm.pm.entity.*;
import com.neouton.crm.pm.service.BrAndBmrService;
import com.neouton.crm.prm.entity.ProjectReturnedMoneyVO;
import com.neouton.crm.prm.service.impl.ProjectReturnedMoneyServiceImpl;
import com.neouton.crm.transpondEmail.service.TranspondEmailService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("brAndBmr")
public class BrAndBmrController {
    @Resource
    private BrAndBmrService brAndBmrService;
    @Resource
    private ProjectReturnedMoneyServiceImpl returnedMoneyService;
    @Resource
    private TranspondEmailService transpondEmailService;

    //撤回
    @PostMapping("/updateBillApplyRecordType")
    public ResponseAPI updateBillApplyRecordType(@RequestBody BillingRecordVo billingRecordVo){
        brAndBmrService.updateBillApplyRecordType(billingRecordVo);
        return ResponseAPI.success();
    }
    /**
     * 逻辑删除回款记录
     * @param id
     * @return
     */
    @GetMapping("/deleteBackMoneyRecordById/{id}")
    public ResponseAPI deleteBackMoneyRecordById( @PathVariable Integer id){
        brAndBmrService.deleteBackMoneyRecordById(id);
        return ResponseAPI.success();
    }

    /**
     * 逻辑删除开票申请、记录
     * @param id
     * @return
     */
    @GetMapping("/deleteBillingById/{id}")
    public ResponseAPI deleteBillingById( @PathVariable Integer id){
        brAndBmrService.deleteBillingById(id);
        return ResponseAPI.success();
    }

    /**
     * 根据回款计划ID查询所有相关金额（已回、未回、开票回款金额）
     * @param bmpId
     * @return
     */
    @GetMapping("/getAllPageShowMoneybyBmpId/{bmpId}")
    public ResponseAPI getAllPageShowMoneybyBmpId(@PathVariable Integer bmpId ){
        return ResponseAPI.successData(brAndBmrService.getAllPageShowMoneybyBmpId(bmpId)) ;
    }

    //修改开票记录 回款状态 （撤回时）
    @GetMapping("/updateBilling/{approvalId}")
    public ResponseAPI updateBilling(@PathVariable Integer approvalId){
        brAndBmrService.updateBilling(approvalId);
        return ResponseAPI.success();
    }

    /**
     * 开票申请撤回
     * @param approvalId
     * @return
     */
    @GetMapping("/updateBackMoneyBillMoneyByApprovalId/{approvalId}")
    public ResponseAPI updateBackMoneyBillMoneyByApprovalId(@PathVariable Integer approvalId){
        brAndBmrService.updateBackMoneyBillMoneyByApprovalId(approvalId);
        return ResponseAPI.success();
    }
    /**
     * 根据approvalId 查询 开票记录页面
     */
    @GetMapping("/searchBillingRecordByApprovalId/{approvalId}")
    public ResponseAPI searchBillingRecordByApprovalId(@PathVariable Integer approvalId) {
        return ResponseAPI.successData(brAndBmrService.searchBillingRecordByApprovalId(approvalId));
    }

    /**
     * 根据approvalId 查询 开票审批页面
     *
     * @param approvalId
     * @return
     */
    @GetMapping("/searchBillingApplyByApprovalId/{approvalId}")
    public ResponseAPI searchBillingApplyByApprovalId(@PathVariable Integer approvalId) {
        return ResponseAPI.successData(brAndBmrService.searchBillingApplyByApprovalId(approvalId));
    }

    /**
     * 根据approvalId 查询 回款记录页面
     *
     * @param approvalId
     * @return
     */
    @GetMapping("/searchBackMoneyRecordByApprovalId/{approvalId}")
    public ResponseAPI searchBackMoneyRecordByApprovalId(@PathVariable Integer approvalId) {
        return ResponseAPI.successData(brAndBmrService.searchBackMoneyRecordByApprovalId(approvalId));
    }

    /**
     * 保存开票申请
     *
     * @param billingApplyVo
     * @return
     */
    @PostMapping("/saveBillingApply")
    public ResponseAPI saveBillingApply(@RequestBody BillingApplyVo billingApplyVo,
                                        @RequestHeader("token") String token) {
        Integer billingRecordId = brAndBmrService.saveBillingApply(billingApplyVo, token);
        return ResponseAPI.successData(billingRecordId);
    }

    /**
     * 保存开票期次、金额关联表（开票申请）
     * @param backBillingMoneylist
     * @param billingRecordId
     * @return
     */
    @PostMapping("/saveBackBillingMoney/{billingRecordId}")
     public ResponseAPI saveBackBillingMoney(@RequestBody List<BackBillingMoneyVo> backBillingMoneylist,
                                             @PathVariable Integer billingRecordId){
        //根据申请id查询审批id
        BillingApplyDto billingApply = brAndBmrService.getBillingApply(billingRecordId);
        Integer approvalId = billingApply.getApprovalId();
        for (BackBillingMoneyVo backBillingMoneyVo : backBillingMoneylist) {
            backBillingMoneyVo.setApprovalId(approvalId);
            backBillingMoneyVo.setBillId(billingRecordId);
        }
        //保存关系表
        brAndBmrService.saveBackBillingMoney(backBillingMoneylist);
        return ResponseAPI.success();
     }
    /**
     * 保存开票期次、金额关联表（开票记录）
     * @param backBillingMoneylist
     * @param billingRecordId
     * @return
     */
    @PostMapping("/saveBackBillingMoneyByBillRecord/{billingRecordId}")
    public ResponseAPI saveBackBillingMoneyByBillRecord(@RequestBody List<BackBillingMoneyVo> backBillingMoneylist,
                                            @PathVariable Integer billingRecordId){
        //根据申请id查询审批id
        BillingApplyDto billingApply = brAndBmrService.getBillingApply(billingRecordId);
        Integer approvalId = billingApply.getApprovalId();
        for (BackBillingMoneyVo backBillingMoneyVo : backBillingMoneylist) {
            backBillingMoneyVo.setApprovalId(approvalId);
            backBillingMoneyVo.setBillRecordId(billingRecordId);
        }
        //保存关系表
        brAndBmrService.saveBackBillingMoney(backBillingMoneylist);
        return ResponseAPI.success();
    }

    /**
     * 保存开票期次、金额关联表（回款记录）
     * @param backBillingMoneylist
     * @param bmrId
     * @return
     */
    @PostMapping("/saveBackBillingMoneyByBackMoneyRecord/{bmrId}")
    public ResponseAPI saveBackBillingMoneyByBackMoneyRecord(@RequestBody List<BackBillingMoneyVo> backBillingMoneylist,
                                                        @PathVariable Integer bmrId){
        //根据申请id查询审批id
        BackMoneyRecordVo backMoneyRecord = brAndBmrService.getBackMoneyRecord(bmrId);
        Integer approvalId = backMoneyRecord.getApprovalId();
        List<Integer> bmpList = new ArrayList<>();
        for (BackBillingMoneyVo backBillingMoneyVo : backBillingMoneylist) {
            backBillingMoneyVo.setApprovalId(approvalId);
            backBillingMoneyVo.setBackMoneyId(bmrId);
            bmpList.add(backBillingMoneyVo.getBmpId());
        }
        //保存关系表
        brAndBmrService.saveBackBillingMoney(backBillingMoneylist);
        ProjectReturnedMoneyVO entity = new ProjectReturnedMoneyVO();
        entity.setBmpIdList(bmpList);
        List<ProjectReturnedMoneyVO> voList = returnedMoneyService.queryReturnedMoneyList(entity);
        if (!voList.isEmpty()) {        //更改消息提醒
            returnedMoneyService.updateMessageFlagByList(voList);
        }
        return ResponseAPI.success();
    }

    /**
     * 保存开票记录
     *
     * @param billingRecordVo
     * @return
     */
    @PostMapping("/saveBillingRecord")
    public ResponseAPI saveBillingRecord(@RequestBody BillingRecordVo billingRecordVo, @RequestHeader("token") String token) {
        Integer billingRecordId = brAndBmrService.saveBillingRecord(billingRecordVo, token);
        return ResponseAPI.successData(billingRecordId);
    }

    /**
     * 修改项目
     *
     * @param billingRecordVo
     * @return
     */
    @PostMapping("/updateBillingRecordAfterPass/")
    public ResponseAPI updateBillingRecordAfterPass(@RequestBody  BillingRecordVo billingRecordVo, @RequestHeader("token") String token) {
        brAndBmrService.updateBillingRecordAfterPass(billingRecordVo,token);
        return  ResponseAPI.successData("success");
    }


    @PostMapping("/queryBillingRecordFromCache/{billingRecordId}")
    public ResponseAPI queryBillingRecordFromCache(@PathVariable(value = "billingRecordId") int billingRecordId, @RequestHeader("token") String token) {
        BillingRecordVo billingRecordVo = brAndBmrService.queryBillingRecordFromCache(billingRecordId, token);
        return ResponseAPI.successData(billingRecordVo);
    }



    /**
     * 修改项目
     *
     * @param billingApplyVo
     * @return
     */
    @PostMapping("/updateBillingApplyAfterPass/")
    public ResponseAPI updateBillingApplyAfterPass(@RequestBody  BillingApplyVo billingApplyVo, @RequestHeader("token") String token) {
        brAndBmrService.updateBillingApplyAfterPass(billingApplyVo,token);
        return  ResponseAPI.successData("success");
    }

    /**
     * 修改项目
     *
     * @param backBillingMoneyVos
     * @return
     */
    @PostMapping("/updateBillingDetailTableAfterPass/")
    public ResponseAPI updateBillingDetailTableAfterPass(@RequestBody  List<BackBillingMoneyVo> backBillingMoneyVos, @RequestHeader("token") String token) {
        brAndBmrService.updateBillingDetailTableAfterPass(backBillingMoneyVos,token);
        return  ResponseAPI.successData("success");
    }




    @PostMapping("/queryBillingApplyFromCache/{billingRecordId}")
    public ResponseAPI queryBillingApplyFromCache(@PathVariable(value = "billingRecordId") int billingRecordId, @RequestHeader("token") String token) {
        BillingApplyVo billingApplyVo = brAndBmrService.queryBillingApplyFromCache(billingRecordId, token);
        return ResponseAPI.successData(billingApplyVo);
    }


    @PostMapping("/queryBillingDetailTableFromCache/{billingRecordId}")
    public ResponseAPI queryBillingDetailTableFromCache(@PathVariable(value = "billingRecordId") int billingRecordId, @RequestHeader("token") String token) {
        List<BackBillingMoneyVo> backBillingMoneyVos = brAndBmrService.queryBillingDetailTableFromCache(billingRecordId, token);
        return ResponseAPI.successData(backBillingMoneyVos);
    }


    /**
     * 获取该项目中所有开票记录 / 开票申请
     *
     * @param id
     * @return
     */
    @GetMapping("/getProjectAllBillingRecord/{id}/{billState}")
    public ResponseAPI getProjectAllBillingRecord(@PathVariable Integer id, @PathVariable Integer billState) {
        return ResponseAPI.successData(brAndBmrService.getProjectAllBillingRecord(id, billState));
    }

    /**
     * 获取该项目中的开票 / 申请 ()
     *
     * @param id
     * @param state
     * @return
     */
    @GetMapping("/getAllBillingApplyPeridName/{id}/{billState}/{state}")
    public ResponseAPI getAllBillingApplyPeridName(@PathVariable Integer id,
                                                   @PathVariable Integer billState,
                                                   @PathVariable Integer state) {
        return ResponseAPI.successData(brAndBmrService.getAllBillingApplyPeridName(id, billState, state));
    }

    /**
     * 保存回款记录
     *
     * @param backMoneyRecordVo
     * @return
     */
    @PostMapping("/saveBackMoneyRecord")
    public ResponseAPI saveBackMoneyRecord(@RequestBody BackMoneyRecordVo backMoneyRecordVo, @RequestHeader("token") String token) {
        return ResponseAPI.successData(brAndBmrService.saveBackMoneyRecord(backMoneyRecordVo, token));
    }

    /**
     * 修改项目
     *
     * @param backMoneyRecordVo
     * @return
     */
    @PostMapping("/updateBackMoneyRecordAfterPass/")
    public ResponseAPI updateBackMoneyRecordAfterPass(@RequestBody BackMoneyRecordVo backMoneyRecordVo, @RequestHeader("token") String token) {
        brAndBmrService.updateBackMoneyRecordAfterPass(backMoneyRecordVo,token);
        return  ResponseAPI.successData("success");
    }

    @PostMapping("/updateBackMoneyDetailTableAfterPass/")
    public ResponseAPI updateBackMoneyDetailTableAfterPass(@RequestBody  List<BackBillingMoneyVo> backBillingMoneyVos, @RequestHeader("token") String token) {
        brAndBmrService.updateBackMoneyDetailTableAfterPass(backBillingMoneyVos,token);
        return  ResponseAPI.successData("success");
    }


    @PostMapping("/queryBackMoneyDetailTableFromCache/{bmrId}")
    public ResponseAPI queryBackMoneyDetailTableFromCache(@PathVariable(value = "bmrId") int bmrId, @RequestHeader("token") String token) {
        List<BackBillingMoneyVo> backBillingMoneyVos = brAndBmrService.queryBackMoneyDetailTableFromCache(bmrId, token);
        return ResponseAPI.successData(backBillingMoneyVos);
    }

    @PostMapping("/querybackMoneyRecordFromCache/{bmrId}")
    public ResponseAPI querybackMoneyRecordFromCache(@PathVariable(value = "bmrId") int bmrId, @RequestHeader("token") String token) {
        BackMoneyRecordVo backMoneyRecordVo = brAndBmrService.querybackMoneyRecordFromCache(bmrId, token);
        return ResponseAPI.successData(backMoneyRecordVo);
    }

    /**
     * 获取该项目中所有回款记录
     *
     * @param id
     * @return
     */
    @GetMapping("/getProjectAllBackMoneyRecord/{id}")
    public ResponseAPI getProjectAllBackMoneyRecord(@PathVariable Integer id) {
        return ResponseAPI.successData(brAndBmrService.getProjectAllBackMoneyRecord(id));
    }

    /**
     * 获取客户中所有回款记录
     *
     * @param id
     * @return
     */
    @GetMapping("/getProjectAllBackMoneyRecordByCustomerId/{customerId}")
    public ResponseAPI getProjectAllBackMoneyRecordByCustomerId(@PathVariable Integer customerId) {
        return ResponseAPI.successData(brAndBmrService.getProjectAllBackMoneyRecordByCustomerId(customerId));
    }

    /**
     * 开票申请页面金额显示
     *
     * @param projectManageId
     * @param contractId
     * @param period
     * @return
     */
    @GetMapping("/getShowMoney/{projectManageId}/{contractId}/{period}")
    public ResponseAPI getShowMoney(@PathVariable Integer projectManageId,
                                    @PathVariable Integer contractId,
                                    @PathVariable List<Integer> period
    ) {
        return ResponseAPI.successData(brAndBmrService.getShowMoney(projectManageId, contractId, period));
    }

    /**
     * 回款记录页面金额显示
     *
     * @param projectManageId
     * @param contractId
     * @param period
     * @return
     */
    @GetMapping("/getBmrShowMoney/{projectManageId}/{contractId}/{period}")
    public ResponseAPI getBmrShowMoney(@PathVariable Integer projectManageId,
                                       @PathVariable Integer contractId,
                                       @PathVariable List<Integer> period
    ) {
        return ResponseAPI.successData(brAndBmrService.getBmrShowMoney(projectManageId, contractId, period));
    }

    /**
     * 获取附件（fileClass - 8 表示开票记录  9 表示回款记录）
     *
     * @param salesRelationId
     * @param fileClass
     * @return
     */
    @GetMapping("/getSalesByBillingRecordId/{salesRelationId}/{fileClass}")
    public ResponseAPI getSalesByBillingRecordId(@PathVariable Integer salesRelationId,
                                                 @PathVariable Integer fileClass) {
        return ResponseAPI.successData(brAndBmrService.getSalesByBillingRecordId(salesRelationId, fileClass));
    }

    /**
     * 定时发布提醒邮件
     */
    public void timingPushHintEmail() {
        brAndBmrService.timingPushHintEmail();
    }

    /**
     * 通过开票申请
     */
    @PostMapping("/passbillingApply")
    public ResponseAPI passbillingApply(@RequestBody BillingApplyVo billingApplyVo, @RequestHeader("token") String token) {
        Boolean flage = brAndBmrService.passbillingApply(billingApplyVo, token,false);
        return ResponseAPI.successData(flage);
    }

    /**
     * 驳回开票申请
     */
    @PostMapping("/rejectBillingApply")
    public ResponseAPI rejectBillingApply(@RequestBody BillingApplyVo billingApplyVo, @RequestHeader("token") String token) {
        Boolean flage = brAndBmrService.rejectBillingApply(billingApplyVo, token);
        return ResponseAPI.successData(flage);
    }

    /**
     * 通过开票记录
     */
    @PostMapping("/passBillingRecord")
    public ResponseAPI passBillingRecord(@RequestBody BillingRecordVo billingRecordVo, @RequestHeader("token") String token) {
        Boolean flage = brAndBmrService.passBillingRecord(billingRecordVo, token,false);
        return ResponseAPI.successData(flage);
    }

    /**
     * 驳回开票记录
     */
    @PostMapping("/rejectBillingRecord")
    public ResponseAPI rejectBillingRecord(@RequestBody BillingRecordVo billingRecordVo, @RequestHeader("token") String token) {
        Boolean flage = brAndBmrService.rejectBillingRecord(billingRecordVo, token);
        return ResponseAPI.successData(flage);
    }

    /**
     * 通过回款记录
     */
    @PostMapping("/passBackMoneyRecord")
    public ResponseAPI passBackMoneyRecord(@RequestBody BackMoneyRecordVo backMoneyRecordVo, @RequestHeader("token") String token) {
        Boolean flage = brAndBmrService.passBackMoneyRecord(backMoneyRecordVo, token,false);
        return ResponseAPI.successData(flage);
    }

    /**
     * 驳回回款记录
     */
    @PostMapping("/rejectBackMoneyRecord")
    public ResponseAPI rejectBackMoneyRecord(@RequestBody BackMoneyRecordVo backMoneyRecordVo, @RequestHeader("token") String token) {
        Boolean flage = brAndBmrService.rejectBackMoneyRecord(backMoneyRecordVo, token);
        return ResponseAPI.successData(flage);
    }

    /**
     * 查询合同是否通过
     */
    @GetMapping("/ContractApplyPassOrNOByContractId/{contractId}")
    public ResponseAPI ContractApplyPassOrNOByContractId(@PathVariable Integer contractId) {
        if (contractId == null) {
            return ResponseAPI.successMes("系统异常，请联系管理员");
        }
        return ResponseAPI.successData(brAndBmrService.ContractApplyPassOrNOByContractId(contractId));
    }

    /**
     * 判断期次是否重复 -- 创建
     *
     * @param contractId
     * @param period
     * @return
     */
    @PostMapping("/judgePeriod/{contractId}/{state}")
    public ResponseAPI judgePeriod(@PathVariable Integer contractId,
                                   @PathVariable Integer state,
                                   @RequestBody List<Integer> period) {
        return ResponseAPI.successData(brAndBmrService.judgePeriod(contractId, state, period));
    }

    /**
     * 判断期次是否重复 -- 修改
     *
     * @param contractId
     * @param period
     * @return
     */
    @PostMapping("/judgePeriodEdit/{contractId}/{billingRecordId}/{state}")
    public ResponseAPI judgePeriodEdit(@PathVariable Integer contractId,
                                       @PathVariable Integer billingRecordId,
                                       @PathVariable Integer state,
                                       @RequestBody List<Integer> period) {
        return ResponseAPI.successData(brAndBmrService.judgePeriodEdit(contractId, billingRecordId, state, period));
    }

    /**
     * 判断回款记录 期次是否重复 -- 修改/创建
     *
     * @param contractId
     * @param period
     * @return
     */
    @PostMapping("/judgeBmrPeriod/{contractId}/{bmrId}")
    public ResponseAPI judgeBmrPeriod(@PathVariable Integer contractId,
                                      @PathVariable Integer bmrId,
                                      @RequestBody List<Integer> period) {
        return ResponseAPI.successData(brAndBmrService.judgeBmrPeriod(contractId, bmrId, period));
    }

    /**
     * 查询回款记录列表
     * @param pageNum
     * @param pageSize
     * @param backMoneyRecordVo
     * @param orderBy
     * @param token
     * @return
     */
    @PostMapping("/getBmrList/{pageNum}/{pageSize}/{orderBy}")
    public ResponseAPI getBmrListByPage(@PathVariable(value = "pageNum") int pageNum,
                                         @PathVariable(value = "pageSize") int pageSize,
                                         @RequestBody BackMoneyRecordVo backMoneyRecordVo, @PathVariable(value = "orderBy") String orderBy, @RequestHeader("token") String token) {
        IPage<BackMoneyRecordVo> page = new Page<>(pageNum, pageSize, true);
        PageUtil<BackMoneyRecordVo> result = brAndBmrService.getBmrListByPage(page, backMoneyRecordVo,orderBy,token);
        return ResponseAPI.successData(result);
    }

    /**
     * 查询开票申请记录列表
     * @param pageNum
     * @param pageSize
     * @param billingApplyVo
     * @param orderBy
     * @param token
     * @return
     */
    @PostMapping("/getBarList/{pageNum}/{pageSize}/{orderBy}")
    public ResponseAPI getBarListByPage(@PathVariable(value = "pageNum") int pageNum,
                                        @PathVariable(value = "pageSize") int pageSize,
                                        @RequestBody BillingApplyVo billingApplyVo, @PathVariable(value = "orderBy") String orderBy, @RequestHeader("token") String token) {
        IPage<BillingApplyVo> page = new Page<>(pageNum, pageSize, true);
        PageUtil<BillingApplyVo> result = brAndBmrService.getBarListByPage(page, billingApplyVo,orderBy,token);
        return ResponseAPI.successData(result);
    }

    /**
     * 查询开票记录列表
     * @param pageNum
     * @param pageSize
     * @param billingRecordVo
     * @param orderBy
     * @param token
     * @return
     */
    @PostMapping("/getBriList/{pageNum}/{pageSize}/{orderBy}")
    public ResponseAPI getBriListByPage(@PathVariable(value = "pageNum") int pageNum,
                                        @PathVariable(value = "pageSize") int pageSize,
                                        @RequestBody BillingRecordVo billingRecordVo, @PathVariable(value = "orderBy") String orderBy, @RequestHeader("token") String token) {
        IPage<BillingRecordVo> page = new Page<>(pageNum, pageSize, true);
        PageUtil<BillingRecordVo> result = brAndBmrService.getBriListByPage(page, billingRecordVo,orderBy,token);
        return ResponseAPI.successData(result);
    }

    @PostMapping("/exportBmr")
    public void exportBmr(HttpServletResponse response,
                                    @RequestBody BackMoneyRecordVo backMoneyRecordVo,
                                    @RequestHeader("token") String token) throws Exception{
        brAndBmrService.exportBmr(response,backMoneyRecordVo,token);
    }

    @PostMapping("/exportBar")
    public void exportBar(HttpServletResponse response,
                          @RequestBody BillingApplyVo billingApplyVo,
                          @RequestHeader("token") String token) throws Exception{
        brAndBmrService.exportBar(response,billingApplyVo,token);
    }

    @PostMapping("/exportBri")
    public void exportBri(HttpServletResponse response,
                          @RequestBody BillingRecordVo billingRecordVo,
                          @RequestHeader("token") String token) throws Exception{
        brAndBmrService.exportBri(response,billingRecordVo,token);
    }

    /**
     * 获取剩余金额（根据计划id）
     * @param bmpId
     * @return
     */
    @GetMapping("/getResidualMoneybyBmpId/{bmpId}")
    public ResponseAPI getResidualMoneybyBmpId(@PathVariable Integer bmpId){
        return ResponseAPI.successData(brAndBmrService.getResidualMoneybyBmpId(bmpId));
    }

    /**
     * 根据审批id查询关系表
     * @return
     */
    @GetMapping("/getBackBillingMoneyByApprovalId/{approvalId}")
    public ResponseAPI getBackBillingMoneyByApprovalId(@PathVariable Integer approvalId ){
        return ResponseAPI.successData(brAndBmrService.getBackBillingMoneyByApprovalId(approvalId));
    }

    @GetMapping("/getPlanShowMoney/{bmpId}")
    public ResponseAPI getPlanShowMoney(@PathVariable Integer bmpId){
        return  ResponseAPI.successData(brAndBmrService.getPlanShowMoney(bmpId));
    }

    @GetMapping("/getBillingApplyisNoChoose/{billingRecordId}")
    public ResponseAPI getBillingApplyisNoChoose(@PathVariable Integer billingRecordId){
        return  ResponseAPI.successData(brAndBmrService.getBillingApplyisNoChoose(billingRecordId));
    }

    @GetMapping("/getBillingRecordisNoChoose/{billingRecordId}")
    public ResponseAPI getBillingRecordisNoChoose(@PathVariable Integer billingRecordId){
        return  ResponseAPI.successData(brAndBmrService.getBillingRecordisNoChoose(billingRecordId));
    }

    @GetMapping("/getSenderListAndName/{approvalId}")
    public ResponseAPI getSenderListAndName(@PathVariable Integer approvalId){
        return  ResponseAPI.successData(transpondEmailService.queryTranspondByApprovalId(approvalId));
    }

}
